// package: rewords-server-2024
// filename: cache
// author: diogoxiang@gmail.com
// time: 2024/7/23 上午9:29

package cacheAPI

import "github.com/gogf/gf/v2/frame/g"

// DataListReq  获取 缓存列表 *Memory
type DataListReq struct {
	g.Meta `path:"/cache/dataList" method:"get" summary:"获取缓存列表" tags:"缓存"`
}

type DataListRes struct {
	Data  g.Map `json:"data"`
	Total int   `json:"total"`
}

// SetDataReq 设置缓存数据
type SetDataReq struct {
	g.Meta `path:"/cache/setData" method:"post" summary:"设置缓存数据" tags:"缓存"`
	Key    string `json:"key" v:"required#缓存key不能为空"`
	Value  string `json:"value" v:"required#缓存value不能为空"`
}

// SetDataRes 设置缓存数据返回
type SetDataRes struct{}

// GetDataByKeyReq 获取缓存数据 by key
type GetDataByKeyReq struct {
	g.Meta `path:"/cache/getDataByKey" method:"get" summary:"获取缓存数据 by key" tags:"缓存"`
	Key    string `json:"key" v:"required#缓存key不能为空"`
}
type GetDataByKeyRes struct {
	Data string `json:"data"`
}

// GetDataByTagReq 获取缓存数据 by tag
type GetDataByTagReq struct {
	g.Meta `path:"/cache/getDataByTag" method:"get" summary:"获取缓存数据 by tag" tags:"缓存"`
	Tag    string `json:"tag" v:"required#缓存tag不能为空"`
}
type GetDataByTagRes struct {
	Data g.Map `json:"data"`
}

// ClearDataReq 清空缓存数据 可以指定key或者tag
type ClearDataReq struct {
	g.Meta `path:"/cache/clearData" method:"get" summary:"清空缓存数据" tags:"缓存"`
	Key    string `json:"key"`
	Tag    string `json:"tag"`
}
type ClearDataRes struct{}
